cSpawnIcon = {}
cSpawnIcon.Height = 64
cSpawnIcon.Width = 64
cSpawnIcon.X = 0
cSpawnIcon.Y = 0
cSpawnIcon.OnClick = nil
cSpawnIcon.Image = nil
cSpawnIcon.OnMouseUp = nil
cSpawnIcon.OnMouseDown = nil
cSpawnIcon.OnHover = nil
cSpawnIcon.Visible = false

function cSpawnIcon:Init()	
	self.Visible = false
end

function cSpawnIcon:SetVisible(bool)
	if not type(bool) == "boolean" then return end
	self.Visible = bool
	--gui.EnableScreenClicker( self.Visible )
end

function cSpawnIcon:Paint()
	if self.Visible then
		surface.SetMaterial(Material(self.Image))
		surface.DrawTexturedRect(self.X,self.Y,self.Height,self.Width)	
	end
	return true
end

function cSpawnIcon:SetImage(image)
	self.Image = image
end

function cSpawnIcon:OnMousePressed( m )
	if ( self.OnMouseDown != nil ) then
		self.OnMouseDown( m );
	end
end

function cSpawnIcon:OnMouseReleased( m )
	if ( self.OnMouseUp != nil ) then
		self.OnMouseUp( m );
	end
end

function cSpawnIcon:OnCursorEntered()
	if ( self.OnHover != nil ) then
		self.OnHover();
	end
end

function cSpawnIcon:OnCursorExited()
	if ( self.OnHoverOut != nil ) then
		self.OnHoverOut();
	end
end
vgui.Register("cSpawnIcon", cSpawnIcon, "Panel")